//
//  RouteCell2.m
//  Marketing
//
//  Created by Hanen 3G 01 on 16/5/12.
//  Copyright © 2016年 Hanen 3G 01. All rights reserved.
//

#import "RouteCell2.h"

@interface RouteCell2 ()
{
    UILabel *label;
}
@end

@implementation RouteCell2
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *routeTypeId = @"cell2";
    RouteCell2 *cell = [tableView dequeueReusableCellWithIdentifier:routeTypeId];
    if (cell == nil) {
        cell = [[RouteCell2 alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:routeTypeId];
        [cell addSubviews];
    }
    
    return cell;
}
- (void)addSubviews
{
    UIImageView *imge = [[UIImageView alloc] initWithFrame:CGRectMake(20.0f,[RouteCell2 cellHeight] / 2.0f - 4, 8, 8)];
    imge.layer.cornerRadius = 4;
    imge.layer.masksToBounds = YES;
//    imge.image = [UIImage imageNamed:@"HY_date_icon_point_normal"];
    imge.backgroundColor = greenBackColor;
    [self.contentView addSubview:imge];
    
    
    self.stationLabel = [ViewTool getLabelWith:CGRectMake(imge.maxX + 20.0f, 0, KSCreenW - 40.0f - 20, [RouteCell2 cellHeight]) WithTitle:@"" WithFontSize:16.0f WithTitleColor:blackFontColor WithTextAlignment:NSTextAlignmentLeft];
    self.stationLabel.numberOfLines = 0;
    [self.contentView addSubview:self.stationLabel];
    
  label = [ViewTool getLabelWith:CGRectMake(_stationLabel.maxX + 5.0f, [RouteCell2 cellHeight] / 2.0f - 15, 80.0f, 30.0f) WithTitle:@"" WithFontSize:16.0f WithTitleColor:grayFontColor WithTextAlignment:NSTextAlignmentLeft];
//    label.backgroundColor = NavBackColor;
//    label.textColor = grayFontColor;
    [self.contentView addSubview:label];
    if (self.isGetON == 1) {
        label.text = @"上车";
    }else if(self.isGetON == 2){
        label.text = @"下车";
    }else{
        label.text = @"";
    }
    
    
}
- (void)setStationInfo:(NSString *)stationInfo
{
    _stationInfo = stationInfo;
    CGFloat wid = [stationInfo boundingRectWithSize:CGSizeMake(MAXFLOAT, 30.0f) options:NSStringDrawingUsesFontLeading| NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:16.0f] ,NSForegroundColorAttributeName : blackFontColor} context:nil].size.width;
    
    CGRect frame = self.stationLabel.frame;
    frame.size.width = wid;
    self.stationLabel.frame = frame;
//    self.stationLabel.backgroundColor = NavBackColor;
    label.frame = CGRectMake(_stationLabel.maxX + 5.0f, [RouteCell2 cellHeight] / 2.0f - 15, 80.0f, 30.0f);

    self.stationLabel.text = self.stationInfo;
    
    if (self.isGetON == 1) {
        label.text = @"上车";
    }else if(self.isGetON == 2){
        label.text = @"下车";
    }
}
+ (CGFloat)cellHeight
{
    return 30.0f;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
